<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/bs/include/comp.inc');
if(!mysql_connect("localhost",$user,$pass))
	die("Error in Database Connection");

if(!mysql_select_db("bs"))
	echo("Error in Database Connection");

$pass=md5($_POST['pass']);
$result=mysql_query("select * from bs_users where name='$_POST[user]' and pass='{$pass}'");

if(!$result)
	echo("Query Fail");
	
$arr=mysql_fetch_array($result);

if($arr["name"]==NULL)
{
echo '<html>
			<link href="style.css" rel="stylesheet" type="text/css" /><body>
			<h2 align="center">XYZ Corporation</h2>
			<a href="http://localhost/bs/">Home</a>
			';

	echo"<h3>Authentication Error</h3>";
	echo"No such username or password found";
}
else
{
	session_start();
	$_SESSION["login"]="yes";
	$_SESSION["username"]=$_POST["user"];
	//echo"You Are Logged in";//divert
	header("Location: http://localhost/bs/start.php");
}


include_once($_SERVER['DOCUMENT_ROOT'].'/bs/include/footer.inc');
?>


